package com.hnichr.ping.signature;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class SignatureHolder {

    private Map<String,SignatureProvider> signatureMap = new HashMap<>();

    @Autowired
    public void init(List<SignatureProvider> ls){
        for(SignatureProvider provider:ls){
            signatureMap.put(provider.getMethod(),provider);
        }
    }

    public SignatureProvider getProvider(String method){
        return signatureMap.get(method);
    }
}
